package com.wyp.design.pattern.behavior.observer;

import java.util.Observable;

/**
 * 被监听者 course  notifyObservers()方法中会调用Observer.update方法.
 */
public class Course extends Observable {
    private String courseName;

    public Course(String courseName) {
        this.courseName = courseName;
    }

    public String getCourseName() {
        return courseName;
    }

    public void produceQuestion(Course course, Question question) {
        System.out.println(question.getUserName() + "在" + course.courseName + "提交了一个问题");
        setChanged();
        notifyObservers(question);

    }


}
